package ezXpns.storage.queries;

import org.apache.lucene.index.Term;
import org.apache.lucene.search.TermQuery;

import ezXpns.BudgetChange;
import ezXpns.storage.Query;


//@author A0088827L
public class TypeQuery implements  Query<BudgetChange>{
	public TypeQuery(String type) {
		this.type = type;
		this.luceneQuery = new TermQuery(new Term("type", type));
	}

	@Override
	public boolean apply(BudgetChange arg) {
		return arg.getType().equals(type);
	}
	@Override
	public org.apache.lucene.search.Query asLuceneQuery() {
		return luceneQuery;
	}	
	
	private String type;
	private org.apache.lucene.search.Query luceneQuery;
}